home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performPolySetToFaceNormal.m < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.6 KB  |  137 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Dec 3, 1998
  22. //
  23. //  Procedure Name:
  24. //      performPolySetToFaceNormal
  25. //
  26. //  Description:
  27. //      Perform an operation that set selected vertex or vertex-face normals
  28. //        to their face normals
  29. //         
  30. //
  31.  
  32. proc setOptionVars (int $forceFactorySettings)
  33. {               
  34.     if ($forceFactorySettings || !`optionVar -exists polySetToFaceNormalUserNormal`)
  35.         optionVar -intValue polySetToFaceNormalUserNormal 1;
  36. }
  37.  
  38. global proc performPolySetToFaceNormalSetup (string $parent, int $forceFactorySettings)
  39. {
  40.     setOptionVars($forceFactorySettings);
  41.     setParent $parent;
  42.  
  43.     int $ival;
  44.  
  45.     $ival = `optionVar -q polySetToFaceNormalUserNormal`;
  46.     checkBoxGrp -e -v1 $ival polySetToFaceNormalUserNormal;    
  47. }
  48.  
  49. global proc performPolySetToFaceNormalCallback (string $parent, int $doIt)
  50. {
  51.     setParent $parent;
  52.  
  53.     optionVar -intValue polySetToFaceNormalUserNormal
  54.         `checkBoxGrp -q -v1 polySetToFaceNormalUserNormal`;
  55.  
  56.     if ($doIt) {
  57.         performPolySetToFaceNormal 0;
  58.         addToRecentCommandQueue "performPolySetToFaceNormal 0" "PolySetToFaceNormal";
  59.     }
  60. }
  61.  
  62. proc polySetToFaceNormalOptions()
  63. {
  64.     string $commandName = "performPolySetToFaceNormal";
  65.     string $callback = ($commandName + "Callback");
  66.     string $setup = ($commandName + "Setup");
  67.        
  68.     string $layout = getOptionBox();
  69.     setParent $layout;
  70.     setUITemplate -pushTemplate DefaultTemplate;
  71.     waitCursor -state 1;
  72.     tabLayout -scr true -tv false;
  73.     
  74.     string $parent = `columnLayout -adjustableColumn 1`;
  75.  
  76.     checkBoxGrp -l1 "Set User Normal"
  77.         polySetToFaceNormalUserNormal;
  78.  
  79.     setParent ..;
  80.  
  81.     waitCursor -state 0;
  82.     setUITemplate -popTemplate;
  83.        
  84.     string $applyBtn = getOptionBoxApplyBtn();
  85.     button -edit -label "Set To Face"
  86.            -command ($callback + " " + $parent + " " + 1)
  87.         $applyBtn;
  88.  
  89.     string $saveBtn = getOptionBoxSaveBtn();
  90.     button -edit 
  91.         -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
  92.         $saveBtn;
  93.  
  94.     string $resetBtn = getOptionBoxResetBtn();
  95.     button -edit 
  96.         -command ($setup + " " + $parent + " " + 1)
  97.         $resetBtn;
  98.              
  99.     setOptionBoxTitle("Polygon Set To Face Normal Options");
  100.  
  101.     setOptionBoxHelpTag( "NormalsSetToFace" );
  102.  
  103.     eval (($setup + " " + $parent + " " + 0));      
  104.     showOptionBox();
  105. }
  106.  
  107. global proc string performPolySetToFaceNormal (int $option)
  108. {
  109.     string $cmd="";
  110.     switch ($option) {
  111.  
  112.       case 1: polySetToFaceNormalOptions; 
  113.         // Just the option box
  114.         break;
  115.         
  116.       default:
  117.         setOptionVars(false);
  118.  
  119.         int $val1 = `optionVar -q polySetToFaceNormalUserNormal`;
  120.  
  121.         if ($val1)
  122.             $cmd = ("polySetToFaceNormal -setUserNormal ");
  123.         else
  124.             $cmd = ("polySetToFaceNormal ");
  125.  
  126.         if ($option == 0)
  127.             evalEcho $cmd;
  128.         break;
  129.     }
  130.     return $cmd;
  131. }
  132.  
  133.  
  134.  
  135.  
  136.  
  137.